package egar

// 基于四叉树的碰撞检测优化

type Point struct {
	X, Y float32
}
type Rectangle struct {
	X, Y, W, H               float32
	Left, Right, Top, Bottom float32
}

type Payload struct {
	QuadTree *Quadtree
	Point    Point
	Data     interface{}
}

type Quadtree struct {
	Parent            *Quadtree
	Boundary          Rectangle
	Objects           []interface{}
	Childrens         [4]*Quadtree
	Depth, DepthLimit int
	Capacity          int
	IsLeaf            bool
}

func (qt *Quadtree) Subdivide() bool {
	if qt.Depth >= qt.DepthLimit {
		return false
	}
	return true
}
